﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StudentMgmt.IDAL;
using StudentMgmt.Model;
using StudentMgmt.Model.DataContext;

namespace StudentMgmt.SQLServerDAL
{
    public class Department : IDepartment
    {
        public DepartmentInfo GetDepartment(string departmentId)
        {
            StudentMgmtDataContext db = new StudentMgmtDataContext();
            var department = db.Departments.Single(d => d.Department_Id == departmentId);

            return department;
        }

        public IList<DepartmentInfo> GetDepartments()
        {
            StudentMgmtDataContext db = new StudentMgmtDataContext();
            var departments = from d in db.Departments
                              select d;

            return departments.ToList();
        }
    }
}
